const fs = require("fs");

let filePromise = new Promise((resolve, reject) => {
    fs.readFile("./data.json1", (err, data) => {
        if (err) reject(err);
        if (data) {
            resolve(data.toString());
        }
        else{
            resolve("");
        }
    });
});

filePromise.then(data => {
    console.log(data);
}, reason => {
    console.warn("错误消息：" + reason);
});

// filePromise.then(data=>{
//     console.log(data);
// }).catch(reason=>{
//     console.warn(reason);
// });